"use strict";

module.exports = function (sequelize, DataTypes) {
    var ConversationHistory = sequelize.define("conversationHistory", {
        single_from: {
            type: DataTypes.INTEGER
        },
        single_to: {
            type: DataTypes.INTEGER
        },
        type: {
            type: DataTypes.ENUM,
            values: ['single', 'group', 'unset'],
            defaultValue: 'unset',
        },
        lastMessageId: {
            type: DataTypes.INTEGER
        },
        lastMsgSendTime: {
            type: DataTypes.INTEGER
        }
    },
        {
            freezeTableName: true,
            paranoid: true,
            indexes: [
                {
                    unique: false,
                    fields: ['single_from']
                },
                {
                    unique: false,
                    fields: ['single_to']
                }
            ],
        });

    ConversationHistory.associate = function (models) {

    }

    return ConversationHistory;
};